
<!--_meta 作为公共模版分离出去-->
{include file="public/_meta"}

<article class="page-container">
    <form action="" method="get" class="form form-horizontal" id="form-admin-auth-add">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>上级规则：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span class="select-box">
					<select id="pid" name="pid" class="select">
                        <option value="0">顶级规则</option>
                        {volist name="ruleTree" id="rule"}
                        <option value="{$rule.id}"><?php echo str_repeat('&nbsp;', $rule['level']*6)?>{$rule.title}</option>
                        {/volist}
                    </select>
				</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>验证方法：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="name" name="name">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>权限名称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="title" name="title">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>权限类型：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="type" name="type">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red"></span></label>
            <div class="col-xs-8 col-sm-9  col-xs-offset-3 col-sm-offset-2">
                <button class="btn btn-success radius" type="submit">添 加</button>
                <button onClick="parent.layer.close(parent.layer.getFrameIndex(window.name));" class="btn btn6 size-M   radius" type="button">取消</button>
            </div>
        </div>
    </form>
</article>


<!--_meta 作为公共模版分离出去-->
{include file="public/_footer"}

<script type="text/javascript">
    $("#form-admin-auth-add").validate({
        rules:{
           /* pid:{
                required:true,
            },
            name:{
                required:true,
            },
            title:{
                required:true,
            },
            type:{
                required:true,
            },*/
        },
        onkeyup:false,
        focusCleanup:true,
        success:"valid",
        submitHandler:function(form){
            var data = $(form).serializeArray();
            $(form).ajaxSubmit({
                url : "{:url('user_auth/add_auth')}",
                type : 'get',
                dataType : 'json',
                data : data,
                async : false,
                success : function(msg){
                    if(msg.status == true){
                        layer.msg(msg.message,{icon: 6,time:1000});
                        setTimeout(jump,1000);
                        function jump(){
                            parent.location.reload();
                        }
                    }else if(msg.status == false){
                        layer.msg(msg.message,{icon: 5,time:1000});
                    }
                }
            });
            //var index = parent.layer.getFrameIndex(window.name);
        }
    });
</script>
